<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >

<mapper namespace="${businessPackagePath}.mapper.${changeTableName}Mapper">

    <resultMap id="BaseResultMap" type="${entityPackagePath}.${changeTableName}" >
<#if modelColumn?exists>
    <#list modelColumn as model>
        <#if model.isId >
        <id column="${model.columnName}" property="${model.changeColumnName?uncap_first}" jdbcType="VARCHAR" />
        <#else>
            <#if model.columnType = 'varchar' || model.columnType = 'text' || model.columnType = 'char' || model.columnType = 'bpchar'>
        <result column="${model.columnName}" property="${model.changeColumnName?uncap_first}" jdbcType="VARCHAR" />
            <#elseif model.columnType = 'timestamp' >
        <result column="${model.columnName}" property="${model.changeColumnName?uncap_first}" jdbcType="TIMESTAMP" />
            <#elseif (model.columnType = 'int2' || model.columnType = 'int4')>
        <result column="${model.columnName}" property="${model.changeColumnName?uncap_first}" jdbcType="NUMERIC" />
            <#elseif model.columnType = 'int8' >
        <result column="${model.columnName}" property="${model.changeColumnName?uncap_first}" jdbcType="LONG" />
            <#elseif model.columnType = 'float4' >
        <result column="${model.columnName}" property="${model.changeColumnName?uncap_first}" jdbcType="FLOAT" />
            <#elseif model.columnType = 'float8' >
        <result column="${model.columnName}" property="${model.changeColumnName?uncap_first}" jdbcType="DOUBLE" />
            <#elseif model.columnType = 'numeric' >
        <result column="${model.columnName}" property="${model.changeColumnName?uncap_first}" jdbcType="BigDecimal" />
            <#elseif model.columnType = 'bool' >
        <result column="${model.columnName}" property="${model.changeColumnName?uncap_first}" jdbcType="BOOLEAN" />
            <#elseif model.columnType = 'date' >
        <result column="${model.columnName}" property="${model.changeColumnName?uncap_first}" jdbcType="DATE" />
            </#if>
        </#if>
    </#list>
</#if>
    </resultMap>

    <sql id="Base_Column_List">
<#if modelColumn?exists>
    <#list modelColumn as model>
        a.${model.columnName}<#if model_has_next>,</#if>
    </#list>
</#if>
    </sql>

    <sql id="Other_Column_List">
<#if modelColumn?exists>
    <#list modelColumn as model>
        a.${model.columnName} "${model.changeColumnName?uncap_first}"<#if model_has_next>,</#if>
    </#list>
</#if>
    </sql>

</mapper>
